package com.sykj.zhensiyuan.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sykj.sys.SysRole;
import com.sykj.utils.BusinessException;
import com.sykj.utils.ResultCode;
import com.sykj.zhensiyuan.mapper.SysRoleMapper;
import com.sykj.zhensiyuan.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName aa
 * @Description TODO
 * Author JiangPengCheng
 * Date 2020/7/13 21:43
 **/
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper,SysRole> implements SysRoleService {
    @Autowired(required = false)
    private SysRoleMapper sysRoleMapper;

    @Override
    public List<SysRole> index(SysRole sysRole) {
        return baseMapper.index(sysRole);
    }

    @Override
    public void add(SysRole sysRole) {
        List<SysRole> sysRoles = sysRoleMapper.selectList();
        for(SysRole sysRole1: sysRoles) {
            System.out.print(sysRole1.getRoleId()+"--------");
            if (sysRole1.getRoleId() != sysRole.getRoleId()){
                 baseMapper.add(sysRole);
            }
            throw new BusinessException(ResultCode.ALL_DELETE_ERROR);
        }
    }
}
